package com.wanmait.demo.webcontroller.usercontroller.personalController;

import com.wanmait.demo.pojo.RepairOrder;
import com.wanmait.demo.pojo.Userinfo;
import com.wanmait.demo.pojo.Worker;
import com.wanmait.demo.service.RepairOrderService;
import com.wanmait.demo.service.WorkerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/user/personalCenter/order")
public class OrderController {
    @Resource
    private RepairOrderService repairOrderService;

    @Resource
    private WorkerService workerService;

    @RequestMapping("/myOrder")
    public List<RepairOrder> all(HttpServletRequest request){



        HttpSession session =request.getSession();
        Userinfo loginUser=(Userinfo)session.getAttribute("loginUser");

        List<RepairOrder> repairOrderList=repairOrderService.findAllById(loginUser.getId());
        return repairOrderList;
    }

//    @RequestMapping("/writeComment")
////    public RepairOrder toComment(int repairOrderId){
////
////        RepairOrder repairOrder= null;
////
////        repairOrder = repairOrderService.findByOrderId(repairOrderId);
////
////        Worker worker= null;
////
////        worker = workerService.zjjfindById(repairOrder.getWorker().getId());
////
////
////        repairOrder.setWorker(worker);
////        return repairOrder;
////    }
//    @RequestMapping("/star")
//    public void tComment(){
//        System.out.println(System.getProperty("java.io.tmpdir"));
//
//    }







}
